

dict1 = {'a': 10, 'b': 8, 'd': 7}

dict2 = {'d': 6, 'c': 4}

for key in dict2.keys():
    if key in dict1.keys():
        if dict1[key]>dict2[key]:
            dict1[key]=dict2[key]
        else:
            continue
    else:
        dict1[key]=dict2[key]


print(dict1)